package com.glory.brepda.adapter;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.brepda.R;
import com.glory.brepda.activity.mfg.BomInfoCheckActivity;
import com.glory.brepda.activity.mfg.ParaInfoCheckActivity;
import com.glory.brepda.entity.BomInfoEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_LogUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

import java.util.List;

public class ParaInfoListAdapter extends BaseQuickAdapter<BomInfoEntity.RECIPEPARALISTResultBean, BaseViewHolder> {
    private boolean mStatus = true;

    public ParaInfoListAdapter(@Nullable List<BomInfoEntity.RECIPEPARALISTResultBean> data, boolean status) {
        super(R.layout.item_para_info_adapter,data);
        this.mStatus = status;
    }

    @Override
    protected void convert(BaseViewHolder helper, BomInfoEntity.RECIPEPARALISTResultBean item) {
        helper.setText(R.id.tvParaGroup,item.getPARAM_GROUP());
        helper.setText(R.id.tvParaName,item.getPARAM_NAME());

        helper.getView(R.id.llRepairLayout).setOnClickListener(view -> {
            //判断是否可点击
            if (mStatus)
                return;
            Bundle bundle= new Bundle();
            bundle.putSerializable("PARAINFO",item);


            FreeApi_LogUtils.saveErrorMessages(item.toString(),"PARAINFO");

            FreeApi_Utils.skipWithExtraIntent("header",bundle,mContext, ParaInfoCheckActivity.class);

        });
    }
}
